package com.sumu.demo.strategy;


import java.math.BigDecimal;

public class FullReducePromotionStrategy implements PromotionStrategy {
    private final BigDecimal fullAmount;
    private final BigDecimal reduceAmount;

    public FullReducePromotionStrategy(BigDecimal fullAmount, BigDecimal reduceAmount) {
        this.fullAmount = fullAmount;
        this.reduceAmount = reduceAmount;
    }

    @Override
    public BigDecimal calculatePromotionAmount(BigDecimal originalAmount) {
        if (originalAmount.compareTo(fullAmount) >= 0) {
            return originalAmount.subtract(reduceAmount);
        }
        return originalAmount;
    }

}